package mr.ali.videoapp.portal.controller;


import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import mr.ali.videoapp.portal.model.CollectionPlayUrl;
import mr.ali.videoapp.portal.service.ICollectionPlayUrlService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Mr-ali
 * @since 2025-07-18
 */
@RestController
@RequestMapping("/portal/collectionPlayUrl")
@Slf4j
public class CollectionPlayUrlController {
    @Resource
    private ICollectionPlayUrlService collectionPlayUrlService;

    @GetMapping("/last")
    public PageInfo<CollectionPlayUrl> last(Integer pageNum, Integer pageSize, Integer userId) {
        log.info("pageNum:{},pageSize:{},userId:{}", pageNum, pageSize, userId);
        return collectionPlayUrlService.findAllByOrderLastUrl(pageNum, pageSize, userId);
    }

    @GetMapping("/first")
    public PageInfo<CollectionPlayUrl> first(Integer pageNum, Integer pagesize, Integer userId, Integer videoId) {
        log.info("pageNum:{},pageSize:{},userId:{},videoId:{}", pageNum, pagesize, userId, videoId);
        return collectionPlayUrlService.collectionPlayList(pageNum, pagesize, userId, videoId);
    }
}
